package com.codo_labs.webapp.pagerankwidget;

import java.io.IOException;
import javax.servlet.http.*;

import com.temesoft.google.pr.PageRankService;

@SuppressWarnings("serial")
public class PageRankWindgetServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		resp.setContentType("text/plain");
		String url = req.getParameter("URLpr");
		PageRankService PRsrv = new PageRankService();
		try {
			int res = PRsrv.getPR(url);
			resp.getWriter().println("callback({'result':'PageRunk: "+res+"'});");
		} catch (Exception e) {
			resp.getWriter().println("callback({'result':'PageRunk error'});");
		}
		
	}
}
